package org.codetranslators.common.optimization;

import org.codetranslators.common.DiGraph;
import org.codetranslators.common.Node;
import org.codetranslators.common.DominatorTree;

public class DominatorCalculationContext {
	
	private DominatorTreeStrategy dominatorTreeStrategy;
	private DiGraph graph;
	private Node startNode;
	
	public DominatorCalculationContext(DiGraph graph, Node startNode){
		this.graph = graph;
		this.startNode = startNode;
		setLengauerTarjan();
	}
	
	public void setLengauerTarjan(){
		dominatorTreeStrategy = new LengauerTarjan();
	}
	
	// TODO - Implement later
	public void setIterativeMethod(){
		dominatorTreeStrategy = null;
	}
	
	public DominatorTree getDominatorTree(){
		return (DominatorTree)dominatorTreeStrategy.getDominatorTree(graph, startNode);
	}

}
